namespace BB.Apostas.Migrations
{
    using System;
    using System.Data.Entity.Migrations;
    
    public partial class v6 : DbMigration
    {
        public override void Up()
        {
            DropForeignKey("dbo.Registoes", "Competicao_Id", "dbo.Competicaos");
            DropForeignKey("dbo.Registoes", "User_UserId", "dbo.UserProfile");
            DropIndex("dbo.Registoes", new[] { "Competicao_Id" });
            DropIndex("dbo.Registoes", new[] { "User_UserId" });
            RenameColumn(table: "dbo.Registoes", name: "Competicao_Id", newName: "CompeticaoId");
            RenameColumn(table: "dbo.Registoes", name: "User_UserId", newName: "UserId");
            AddForeignKey("dbo.Registoes", "CompeticaoId", "dbo.Competicaos", "Id", cascadeDelete: true);
            AddForeignKey("dbo.Registoes", "UserId", "dbo.UserProfile", "UserId", cascadeDelete: true);
            CreateIndex("dbo.Registoes", "CompeticaoId");
            CreateIndex("dbo.Registoes", "UserId");
        }
        
        public override void Down()
        {
            DropIndex("dbo.Registoes", new[] { "UserId" });
            DropIndex("dbo.Registoes", new[] { "CompeticaoId" });
            DropForeignKey("dbo.Registoes", "UserId", "dbo.UserProfile");
            DropForeignKey("dbo.Registoes", "CompeticaoId", "dbo.Competicaos");
            RenameColumn(table: "dbo.Registoes", name: "UserId", newName: "User_UserId");
            RenameColumn(table: "dbo.Registoes", name: "CompeticaoId", newName: "Competicao_Id");
            CreateIndex("dbo.Registoes", "User_UserId");
            CreateIndex("dbo.Registoes", "Competicao_Id");
            AddForeignKey("dbo.Registoes", "User_UserId", "dbo.UserProfile", "UserId");
            AddForeignKey("dbo.Registoes", "Competicao_Id", "dbo.Competicaos", "Id");
        }
    }
}
